package com.blockmeta.bbs.baselibrary.widget;

import android.content.Context;
import androidx.viewpager.widget.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * Created by AirThor
 * Date 2018/3/3.
 */

public class ToggleScrollViewPager extends ViewPager {
    private boolean isCanScroll=true;
    public void setCanScroll(boolean canScroll) {
        isCanScroll = canScroll;
    }

    public ToggleScrollViewPager(Context context) {
        super(context);
    }

    public ToggleScrollViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    }


    @Override
    public boolean onInterceptTouchEvent(MotionEvent arg0) {
        if (isCanScroll) {
            return super.onInterceptTouchEvent(arg0);
        } else {
            return false;
        }

    }
}
